<template>
	<view :style="Theme">
		<uni-nav-bar leftIcon="left" :fixed="true" title="注册" />
		<view class="logo">
			<image src="/static/logo.png"></image>
		</view>
		<view class="content">
			<view class="row-input">
				<i class="iconfont icon-shouji" />
				<input placeholder="请输入手机号码" maxlength="11" />
			</view>
			<view class="row-input">
				<i class="iconfont icon-verCode" />
				<input placeholder="请输入验证码" maxlength="6" />
				<view class="code" :class="{forhidden: counter > 0}" @click="getCode">
					<text> {{ counter > 0 ? counter+ 'S后重新获取' : '获取验证码' }}</text>
				</view>
			</view>
			<view class="row-input">
				<i class="iconfont icon-mima" />
				<input placeholder="请输入您的密码" maxlength="16" />
			</view>
			<view class="row-input">
				<i class="iconfont icon-mima" />
				<input placeholder="请再次输入您的密码" maxlength="16" />
			</view>
			<view class="register-btn">注册</view>
			<view class="tip-link">
				<checkbox :checked="true" style="transform: scale(0.6);" color="var(--primary-color)" />
			    <text>我同意并接受</text>
				<text class="link">《用户协议》</text>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { useCountDown } from '@/hooks/useCountDown'
	const { counter, startCountDown } = useCountDown()
	const { Theme, onShow } = useTheme()
	const { proxy } = getCurrentInstance()
	
	onLoad(() => {
		
	})
	
	onShow(() => {
		
	})
	
	const getCode = () => {
		if(counter.value > 0) {
			proxy.sjuAlert.showInfo('验证码已发送')
		} else {
			startCountDown(60)
		}
	}
</script>

<style lang="scss">
	.logo{
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		height: 300rpx;
		image{
			width: 200rpx;
			height: 200rpx;
		}
	}
	
	.content {
		padding: 40rpx;
	
		.row-input {
			margin: 30rpx 0rpx;
			display: flex;
			justify-content: flex-start;
			align-items: center;
			padding: 0 20rpx;
			height: 100rpx;
			border: 1rpx solid var(--primary-color);
			border-radius: 20rpx;
			
			image {
				padding: 0rpx 10rpx 0rpx 10rpx;
				width: 50rpx;
				height: 50rpx;
				flex-shrink: 0;
			}
			
			.iconfont {
				color: var(--primary-color);
				padding: 0rpx 10rpx 0rpx 10rpx;
				flex-shrink: 0;
				font-size: 40rpx;
			}
	
			input {
				flex: 1;
				font-size: 30rpx;
				padding: 0rpx 40rpx;
				color: var(--primary-color);
				border-left: 3rpx solid var(--primary-color);
			}
	
			.code {
				display: flex;
				justify-content: flex-end;
				letter-spacing: 2rpx;
				width: 200rpx;
				color: var(--primary-color);
			}
			
			.forhidden {
				color: #CCCCCC;
			}
		}
	
		.register-btn {
			display: flex;
			justify-content: center;
			align-items: center;
			font-size: 35rpx;
			height: 100rpx;
			margin: 40rpx 0 40rpx 0;
			border-radius: 20rpx;
			color: #FFFFFF;
			background-color: var(--btn-bg-color);
		}
		
		.tip-link{
			display: flex;
			justify-content: flex-start;
			align-items: center;
			letter-spacing: 4rpx;
			font-size: 28rpx;
			
			.link{
				color: var(--primary-color);
			}
			
		}
	}
</style>
